package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entities.Dept;
import com.atguigu.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther:
 * @Description:
 * @Date: 2019/11/19 15:46
 */
@RestController
@RequestMapping("/consumer_feign")
public class DeptController_Consumer {

    @Autowired
    private DeptClientService deptClientService;

    //    @PostMapping("/dept/add")
    @RequestMapping("/dept/add")
    public boolean add(Dept dept) {
        return deptClientService.add(dept);
    }

    @GetMapping("/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return deptClientService.get(id);
    }

    @GetMapping("/dept/list")
    public List<Dept> list() {
        System.out.println("feign-->dept/list");
        return deptClientService.list();
    }

}
